function setToolbars(divId, mainItemParams, rightItemParams) {
    var toolbarHtml = "";
    toolbarHtml += "<div id='toolbar_main'></div>";
    toolbarHtml += "<div id='toolbar_right'></div>";
    toolbarHtml += "<div class='toolbar_clear'></div>";

    $("#" + divId).html(toolbarHtml);

    setToolbarItem("toolbar_main", mainItemParams);
    setToolbarItem("toolbar_right", rightItemParams);
}

/**
 * [itme_type, img_src, script_name, text]
 * item_type : separator, img_only, text_only, img_text
 */
function setToolbarItem(divId, params) {
    var resultStr = getToolbarItemsHtml(params);
    $("#" + divId).html(resultStr);
}

function getToolbarItemsHtml(params) {
    var imgRelateLocation = "style/powerhua/platform/toolbar/images/";
    var resultStr = "";
    for(var i = 0; i < params.length; i++) {
        var param = params[i];
        if(param[0] == "img_text") {
            resultStr += "<img src=\"" + imgRelateLocation + param[1] + "\""
            + " alt=\"" + param[3] + "\""
            + " onclick=\"javascript:" + param[2] + ";\"> ";
            resultStr += "<a href=\"#\""
            + " onclick=\"javascript:" + param[2] + ";\">"
            + param[3] + "</a>";
        } else if(param[0] == "img_only") {
            resultStr += "<img src=\"" + imgRelateLocation + param[1] + "\""
            + " alt=\"" + param[3] + "\""
            + " onclick=\"javascript:" + param[2] + ";\">";
        } else if(param[0] == "text_only") {
            resultStr += "<a href=\"#\""
            + " onclick=\"javascript:" + param[2] + ";\">"
            + param[3] + "</a>";
        } else if(param[0] == "separator") {
            resultStr += "<img class=\"separator\" src=\"" + imgRelateLocation + param[1] + "\""
            + " >";
        }
    }
    return resultStr;
}